package com.imporven.sell.service.impl;

import com.imporven.sell.dto.OrderDTO;
import com.imporven.sell.service.BuyerService;
import com.imporven.sell.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author imporven
 * @version 1.0.0
 * @date 2018-7-17 1:21
 */
@Service
public class BuyerServiceImp implements BuyerService {

    @Autowired
    private OrderService orderService;

    @Override
    public OrderDTO findOrderOne(String openid, String orderId) {
        return orderService.findOne(orderId)
                .filter(orderDTO -> orderDTO.getBuyerOpenid().equalsIgnoreCase(openid))
                .orElse(null);
    }

}
